//
//  LevelScreen.cpp
//  FruitCrush
//
//  Created by gaoyu on 15/8/8.
//
//

#include "CountDownModeLevelScreen.h"

CountDownModeLevelScreen::CountDownModeLevelScreen()
{
    
}


Scene *CountDownModeLevelScreen::createScene(int level)
{
    auto scene = Scene::create();
    auto layer = CountDownModeLevelScreen::create(level);
    scene->addChild(layer);
    return scene;
}

CountDownModeLevelScreen* CountDownModeLevelScreen::create(int level)
{
	CountDownModeLevelScreen *pRet = new(std::nothrow) CountDownModeLevelScreen();
    if (pRet && pRet->init(level)){
        pRet->baseInit();
        pRet->autorelease();
        return pRet;
    }
    else
    {
        delete pRet;
        pRet = NULL;
        return NULL;
    }
}

bool CountDownModeLevelScreen::init(int level)
{
    m_level = level;
    typeNumLimit = CountDownModeLevelScreenConfig::getTypeNumLimit(level);
    moveStepLeft = CountDownModeLevelScreenConfig::getMoveStepLeft(level);
    moveStepLimit = moveStepLeft;
    monsterType = CountDownModeLevelScreenConfig::getMonsterType(level);
    PlayLevelRecorder::getInstance()->setNowPlayLevel(level);
    bad_matrix = CountDownModeLevelScreenConfig::getBadStateMatrix(level);
    bad_matrixUp = CountDownModeLevelScreenConfig::getBadUpStateMatrix(level);
    jelly_Matrix = CountDownModeLevelScreenConfig::getJellyMatrix(level);
    m_bombNum = CountDownModeLevelScreenConfig::getBombNum(level);
  //  bad_matrixProtectCover = LevelScreenConfig::getProtectCoverMatrix(level);
    bad_matrixBlank = CountDownModeLevelScreenConfig::getBlankMatrix(level);
    return true;
}
